<template>
  <div class="vip-page">
    <!-- 顶部会员横幅 -->
    <div class="vip-banner">
      <div class="banner-content">
        <h1 class="vip-title">VIP特权</h1>
        <p class="vip-slogan">成为乐享视频VIP，畅享精彩生活</p>
        <div v-if="userMemberInfo.level === 'none'" class="vip-promo">
          <span class="promo-text">🎉 首次开通会员可享受限时优惠！</span>
        </div>
        <div class="banner-actions">
          <button class="btn-primary" @click="showVipPlans">立即开通</button>
          <button class="btn-secondary" @click="showMemberStatus">查看我的会员</button>
        </div>
      </div>
    </div>

    <!-- 会员类型切换 -->
    <div class="vip-tabs">
      <div 
        class="tab-item" 
        :class="{ active: activeTab === 'category' }"
        @click="activeTab = 'category'"
      >
        分类特权
      </div>
      <div 
        class="tab-item" 
        :class="{ active: activeTab === 'level' }"
        @click="activeTab = 'level'"
      >
        等级特权
      </div>
    </div>

    <!-- 分类特权内容 -->
    <div v-if="activeTab === 'category'" class="vip-privileges">
      <!-- SVIP专享 -->
      <div class="privilege-section">
        <div class="section-title">
          <span class="section-badge">SVIP专享</span>
        </div>
        <div class="privilege-grid">
          <div v-for="privilege in svipPrivileges" :key="privilege.id" class="privilege-item">
            <div class="privilege-icon">{{ privilege.icon }}</div>
            <div class="privilege-name">{{ privilege.name }}</div>
            <div class="privilege-desc">{{ privilege.description }}</div>
          </div>
        </div>
      </div>

      <!-- 内容特权 -->
      <div class="privilege-section">
        <div class="section-title">
          <span class="section-badge">内容特权</span>
        </div>
        <div class="privilege-grid">
          <div v-for="privilege in contentPrivileges" :key="privilege.id" class="privilege-item">
            <div class="privilege-icon">{{ privilege.icon }}</div>
            <div class="privilege-name">{{ privilege.name }}</div>
            <div class="privilege-desc">{{ privilege.description }}</div>
          </div>
        </div>
      </div>

      <!-- 视听特权 -->
      <div class="privilege-section">
        <div class="section-title">
          <span class="section-badge">视听特权</span>
        </div>
        <div class="privilege-grid">
          <div v-for="privilege in audioVisualPrivileges" :key="privilege.id" class="privilege-item">
            <div class="privilege-icon">{{ privilege.icon }}</div>
            <div class="privilege-name">{{ privilege.name }}</div>
            <div class="privilege-desc">{{ privilege.description }}</div>
          </div>
        </div>
      </div>

      <!-- 服务特权 -->
      <div class="privilege-section">
        <div class="section-title">
          <span class="section-badge">服务特权</span>
        </div>
        <div class="privilege-grid">
          <div v-for="privilege in servicePrivileges" :key="privilege.id" class="privilege-item">
            <div class="privilege-icon">{{ privilege.icon }}</div>
            <div class="privilege-name">{{ privilege.name }}</div>
            <div class="privilege-desc">{{ privilege.description }}</div>
          </div>
        </div>
      </div>
    </div>

    <!-- 等级特权内容 -->
    <div v-if="activeTab === 'level'" class="vip-levels">
      <div class="level-comparison">
        <div class="level-header">
          <div class="level-item">特权项</div>
          <div class="level-item free">非会员</div>
          <div class="level-item vip">VIP会员</div>
          <div class="level-item svip">SVIP会员</div>
        </div>
        
        <div v-for="(comparison, index) in levelComparisons" :key="index" class="level-row">
          <div class="level-item privilege-name">{{ comparison.name }}</div>
          <div class="level-item free">{{ comparison.free }}</div>
          <div class="level-item vip">{{ comparison.vip }}</div>
          <div class="level-item svip">{{ comparison.svip }}</div>
        </div>
      </div>
    </div>

    <!-- VIP套餐选择弹窗 -->
    <div v-if="showVipModal" class="modal-overlay" @click="closeVipModal">
      <div class="modal-content" @click.stop>
        <div class="modal-header">
          <h2>选择会员套餐</h2>
          <button class="modal-close" @click="closeVipModal">&times;</button>
        </div>
        <div class="modal-body">
          <div class="membership-tabs">
            <div 
              class="tab-item" 
              :class="{ active: selectedMemberType === 'vip' }"
              @click="selectedMemberType = 'vip'"
            >
              VIP会员
            </div>
            <div 
              class="tab-item" 
              :class="{ active: selectedMemberType === 'svip' }"
              @click="selectedMemberType = 'svip'"
            >
              SVIP会员
            </div>
          </div>
          
          <div class="pricing-cards">
            <div 
              v-for="plan in selectedPlans" 
              :key="plan.duration" 
              class="pricing-card"
              :class="{ selected: selectedPlan === plan }"
              @click="selectedPlan = plan"
            >
              <div class="pricing-period">{{ plan.period }}</div>
              <div class="pricing-price">
                <span class="current-price">{{ isFirstPurchase() ? plan.discountPrice : plan.originalPrice }}元</span>
                <span v-if="plan.originalPrice && isFirstPurchase()" class="original-price">{{ plan.originalPrice }}元</span>
              </div>
              <div class="pricing-desc">{{ plan.description }}</div>
              <div v-if="plan.tag" class="pricing-tag">{{ plan.tag }}</div>
              <div v-if="isFirstPurchase() && plan.originalPrice" class="pricing-discount">
                🔖 首次开通优惠
              </div>
            </div>
          </div>
        </div>
        <div class="modal-footer">
          <button class="btn-secondary" @click="closeVipModal">取消</button>
          <button class="btn-primary" @click="purchaseVip">确认开通</button>
        </div>
      </div>
    </div>

    <!-- 会员状态弹窗 -->
    <div v-if="showStatusModal" class="modal-overlay" @click="closeStatusModal">
      <div class="modal-content" @click.stop>
        <div class="modal-header">
          <h2>我的会员</h2>
          <button class="modal-close" @click="closeStatusModal">&times;</button>
        </div>
        <div class="modal-body">
          <div v-if="userMemberInfo.level === 'none'" class="no-member">
            <div class="no-member-icon">🔒</div>
            <p>您当前未开通会员</p>
            <button class="btn-primary small" @click="closeStatusModal(); showVipPlans">立即开通</button>
          </div>
          <div v-else class="member-info">
            <div class="member-level">
              <span class="level-badge" :class="userMemberInfo.level">
                {{ userMemberInfo.level.toUpperCase() }}
              </span>
              <span class="member-type">会员</span>
            </div>
            <div class="member-details">
              <div class="detail-item">
                <span class="detail-label">当前会员：</span>
                <span class="detail-value">{{ userMemberInfo.level.toUpperCase() }}</span>
              </div>
              <div class="detail-item">
                <span class="detail-label">当前到期时间：</span>
                <span class="detail-value">{{ userMemberInfo.expireDate }}</span>
              </div>
              <div class="detail-item">
                <span class="detail-label">VIP到期时间：</span>
                <span class="detail-value" :class="{ 'expired': userMemberInfo.vipExpireDate && new Date(userMemberInfo.vipExpireDate) <= new Date() }">{{ userMemberInfo.vipExpireDate || '未开通' }}</span>
              </div>
              <div class="detail-item">
                <span class="detail-label">SVIP到期时间：</span>
                <span class="detail-value" :class="{ 'expired': userMemberInfo.svipExpireDate && new Date(userMemberInfo.svipExpireDate) <= new Date() }">{{ userMemberInfo.svipExpireDate || '未开通' }}</span>
              </div>
              <div class="detail-item">
                <span class="detail-label">会员等级：</span>
                <span class="detail-value">{{ userMemberInfo.memberLevel }}级</span>
              </div>
              <div class="detail-item">
                <span class="detail-label">成长值：</span>
                <span class="detail-value">{{ userMemberInfo.growthValue }}/1000</span>
              </div>
            </div>
            <button class="btn-primary small" @click="renewMember">立即续费</button>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'VipView',
  data() {
    return {
      activeTab: 'category',
      showVipModal: false,
      showStatusModal: false,
      selectedMemberType: 'vip',
      selectedPlan: null,
      // SVIP专享特权
      svipPrivileges: [
        {
          id: 1,
          icon: '🏠',
          name: '多设备登录',
          description: '最多支持4台设备同时登录',
        },
        {
          id: 2,
          icon: '🔮',
          name: 'SVIP抢先看',
          description: '热门剧集提前24小时观看',
        },
        {
          id: 3,
          icon: '🎬',
          name: '4K画质',
          description: '超高清观影体验',
        },
        {
          id: 4,
          icon: '🎵',
          name: '杜比音效',
          description: '沉浸式听觉体验',
        },
        {
          id: 5,
          icon: '🎁',
          name: 'SVIP优惠券',
          description: '每月领取专属观影券',
        },
        {
          id: 6,
          icon: '💰',
          name: '购物折扣',
          description: '周边商城专属折扣',
        },
      ],
      // 内容特权
      contentPrivileges: [
        {
          id: 7,
          icon: '⏩',
          name: '内容超前看',
          description: 'VIP专属提前看',
        },
        {
          id: 8,
          icon: '🎥',
          name: '免费观影',
          description: 'VIP片库免费看',
        },
        {
          id: 9,
          icon: '🎬',
          name: '点播折扣',
          description: '付费点播享受折扣',
        },
        {
          id: 10,
          icon: '🎦',
          name: '直播优惠',
          description: '直播赛事专属优惠',
        },
        {
          id: 11,
          icon: '🎞️',
          name: '专属影院',
          description: 'VIP专享独立影院',
        },
        {
          id: 12,
          icon: '👥',
          name: '好友免费看',
          description: '分享影片好友免费观看',
        },
        {
          id: 13,
          icon: '🎫',
          name: '观影券',
          description: '每月领取观影券',
        },
      ],
      // 视听特权
      audioVisualPrivileges: [
        {
          id: 14,
          icon: '📺',
          name: '蓝光画质',
          description: '1080P高清观影',
        },
        {
          id: 15,
          icon: '🎧',
          name: '会员音效',
          description: '高品质音效体验',
        },
        {
          id: 16,
          icon: '🎼',
          name: '音效选择',
          description: '多种音效模式选择',
        },
        {
          id: 17,
          icon: '🎶',
          name: '无损音质',
          description: '高品质音乐享受',
        },
        {
          id: 18,
          icon: '🔊',
          name: '沉浸式音效',
          description: '3D环绕声体验',
        },
        {
          id: 19,
          icon: '🎤',
          name: '演唱会直播',
          description: '高清演唱会直播',
        },
      ],
      // 服务特权
      servicePrivileges: [
        {
          id: 20,
          icon: '🚫',
          name: '无广告打扰',
          description: '观看无广告',
        },
        {
          id: 21,
          icon: '💾',
          name: '离线缓存',
          description: '支持视频离线缓存',
        },
        {
          id: 22,
          icon: '⏭️',
          name: '跳过片头片尾',
          description: '智能跳过片头片尾',
        },
        {
          id: 23,
          icon: '⚡',
          name: '极速加载',
          description: '视频加速加载',
        },
        {
          id: 24,
          icon: '📱',
          name: '多端同步',
          description: '观看记录多端同步',
        },
        {
          id: 25,
          icon: '👑',
          name: '专属标识',
          description: '评论区专属身份标识',
        },
      ],
      // 等级对比数据
      levelComparisons: [
        {
          name: '无广告观看',
          free: '❌',
          vip: '✅',
          svip: '✅',
        },
        {
          name: '高清画质',
          free: '超清',
          vip: '1080P',
          svip: '4K',
        },
        {
          name: '多设备同时登录',
          free: '1台',
          vip: '2台',
          svip: '4台',
        },
        {
          name: '超前点播',
          free: '❌',
          vip: '部分',
          svip: '全部',
        },
        {
          name: 'VIP专属内容',
          free: '❌',
          vip: '✅',
          svip: '✅',
        },
        {
          name: '杜比音效',
          free: '❌',
          vip: '❌',
          svip: '✅',
        },
        {
          name: '视频广告过滤',
          free: '❌',
          vip: '部分',
          svip: '✅',
        },
        {
          name: '每月观影券',
          free: '0张',
          vip: '2张',
          svip: '8张',
        },
        {
          name: '好友免费看',
          free: '❌',
          vip: '2次/月',
          svip: '10次/月',
        },
      ],
      // 会员套餐 - 原始价格
      vipPlans: [
        { 
          duration: 'monthly', 
          period: '月度', 
          discountPrice: 20, 
          originalPrice: 20, 
          description: '有效期30天', 
          tag: '灵活选择',
          autoRenew: false,
        },
        { 
          duration: 'quarterly', 
          period: '季度', 
          discountPrice: 50, 
          originalPrice: 50, 
          description: '有效期90天', 
          tag: '节省10元',
          autoRenew: false,
        },
        { 
          duration: 'yearly', 
          period: '年度', 
          discountPrice: 180, 
          originalPrice: 198, 
          description: '有效期365天', 
          tag: '最划算',
          autoRenew: false,
        },
        { 
          duration: 'continuous_monthly', 
          period: '连续包月', 
          discountPrice: 16, 
          originalPrice: 18, 
          description: '首月16元，次月起18元/月，自动续费', 
          tag: '首月优惠',
          autoRenew: true,
        },
        { 
          duration: 'continuous_yearly', 
          period: '连续包年', 
          discountPrice: 168, 
          originalPrice: 188, 
          description: '首年168元，次年起188元/年，自动续费', 
          tag: '年度优惠',
          autoRenew: true,
        },
      ],
      // SVIP会员套餐 - 原始价格
      svipPlans: [
        { 
          duration: 'monthly', 
          period: '月度', 
          discountPrice: 35, 
          originalPrice: 35, 
          description: '有效期30天', 
          tag: '灵活选择',
          autoRenew: false,
        },
        { 
          duration: 'quarterly', 
          period: '季度', 
          discountPrice: 90, 
          originalPrice: 90, 
          description: '有效期90天', 
          tag: '节省15元',
          autoRenew: false,
        },
        { 
          duration: 'yearly', 
          period: '年度', 
          discountPrice: 300, 
          originalPrice: 300, 
          description: '有效期365天', 
          tag: '最划算',
          autoRenew: false,
        },
        { 
          duration: 'continuous_monthly', 
          period: '连续包月', 
          discountPrice: 25, 
          originalPrice: 32, 
          description: '首月25元，次月起32元/月，自动续费', 
          tag: '首月优惠',
          autoRenew: true,
        },
        { 
          duration: 'continuous_yearly', 
          period: '连续包年', 
          discountPrice: 260, 
          originalPrice: 288, 
          description: '首年260元，次年起288元/年，自动续费', 
          tag: '年度优惠',
          autoRenew: true,
        },
      ],
      // 用户会员信息
      userMemberInfo: {
        level: 'none', // none, vip, svip (当前活跃会员类型)
        expireDate: '', // 当前活跃会员的到期时间
        vipExpireDate: '', // VIP会员到期时间
        svipExpireDate: '', // SVIP会员到期时间
        memberLevel: 0,
        growthValue: 0,
        autoRenew: false, // 是否自动续费
        continuousPlan: '', // 连续套餐类型
        isTrial: false, // 是否处于试用期
      },
    }
  },
  computed: {
    selectedPlans() {
      return this.selectedMemberType === 'vip' ? this.vipPlans : this.svipPlans
    },
  },
  mounted() {
    this.loadMemberInfo()
  },
  methods: {
    // 显示VIP套餐弹窗
    showVipPlans() {
      this.showVipModal = true
      this.selectedPlan = this.selectedPlans[0] // 默认选择第一个套餐
    },
      
    // 检查是否是首次购买会员
    isFirstPurchase() {
      return this.userMemberInfo.level === 'none'
    },
    
    // 关闭VIP套餐弹窗
    closeVipModal() {
      this.showVipModal = false
    },
    
    // 显示会员状态弹窗
    showMemberStatus() {
      this.showStatusModal = true
    },
    
    // 关闭会员状态弹窗
    closeStatusModal() {
      this.showStatusModal = false
    },
    
    // 购买VIP
    purchaseVip() {
      if (!this.selectedPlan) {
        alert('请选择会员套餐')
        return
      }
      
      // 检查用户是否已登录
      const currentUser = JSON.parse(localStorage.getItem('currentUser'))
      if (!currentUser) {
        alert('请先登录')
        return
      }
      
      // 检查是否是首次开通该类型会员（排除试用期）
      const isFirstPurchase = (this.selectedMemberType === 'vip' && (this.userMemberInfo.vipExpireDate === '' || new Date(this.userMemberInfo.vipExpireDate) <= new Date())) || 
        (this.selectedMemberType === 'svip' && (this.userMemberInfo.svipExpireDate === '' || new Date(this.userMemberInfo.svipExpireDate) <= new Date())) ||
        (this.userMemberInfo.level === 'vip' && this.userMemberInfo.isTrial)
      
      // 根据是否是首次购买选择价格
      let finalPrice
      if (isFirstPurchase || (!isFirstPurchase && !this.selectedPlan.autoRenew)) {
        // 首次购买或非自动续费套餐，使用折扣价
        finalPrice = this.selectedPlan.discountPrice
      } else {
        // 自动续费套餐的续费，使用原价
        finalPrice = this.selectedPlan.originalPrice
      }
      
      // 模拟购买成功
      const now = new Date()
      let newExpireDate
      const memberType = this.selectedMemberType
      
      // 计算新的到期时间
      if (memberType === 'vip' && this.userMemberInfo.vipExpireDate && new Date(this.userMemberInfo.vipExpireDate) > now) {
        // 已有VIP有效期，在现有基础上增加时间
        newExpireDate = new Date(this.userMemberInfo.vipExpireDate)
      } else if (memberType === 'svip' && this.userMemberInfo.svipExpireDate && new Date(this.userMemberInfo.svipExpireDate) > now) {
        // 已有SVIP有效期，在现有基础上增加时间
        newExpireDate = new Date(this.userMemberInfo.svipExpireDate)
      } else {
        // 从当前时间开始计算
        newExpireDate = new Date()
      }
      
      // 根据套餐类型增加时间
      if (this.selectedPlan.duration === 'monthly' || this.selectedPlan.duration === 'continuous_monthly') {
        newExpireDate.setMonth(newExpireDate.getMonth() + 1)
      } else if (this.selectedPlan.duration === 'quarterly') {
        newExpireDate.setMonth(newExpireDate.getMonth() + 3)
      } else {
        newExpireDate.setFullYear(newExpireDate.getFullYear() + 1)
      }
      
      // 更新会员信息
      const updatedMemberInfo = {
        ...this.userMemberInfo,
        memberLevel: Math.max(this.userMemberInfo.memberLevel, memberType === 'svip' ? 2 : 1),
        growthValue: this.userMemberInfo.growthValue + 100,
        autoRenew: this.selectedPlan.autoRenew || false,
        continuousPlan: this.selectedPlan.autoRenew ? this.selectedPlan.duration : '',
        isTrial: false, // 购买正式会员后，不再是试用期
      }
      
      // 根据购买的会员类型更新对应的到期时间
      if (memberType === 'vip') {
        updatedMemberInfo.vipExpireDate = newExpireDate.toLocaleDateString('zh-CN')
      } else {
        updatedMemberInfo.svipExpireDate = newExpireDate.toLocaleDateString('zh-CN')
      }
      
      // 更新当前活跃会员类型和到期时间
      this.updateActiveMember(updatedMemberInfo)
      this.userMemberInfo = updatedMemberInfo
      
      // 保存到localStorage
      localStorage.setItem('userMemberInfo', JSON.stringify(this.userMemberInfo))
      
      this.closeVipModal()
      
      // 首次购买显示优惠信息
      if (isFirstPurchase) {
        alert(`恭喜您享受首次开通优惠！已以${finalPrice}元成功开通会员！`)
      } else {
        alert(`会员开通成功！已以${finalPrice}元成功开通会员！有效期至${this.userMemberInfo.expireDate}`)
      }
    },
    
    // 续费会员
    renewMember() {
      this.closeStatusModal()
      this.selectedMemberType = this.userMemberInfo.level
      this.showVipPlans()
    },
    
    // 更新当前活跃会员类型和到期时间
    updateActiveMember(memberInfo) {
      const now = new Date()
      const vipExpire = memberInfo.vipExpireDate ? new Date(memberInfo.vipExpireDate) : null
      const svipExpire = memberInfo.svipExpireDate ? new Date(memberInfo.svipExpireDate) : null
      
      // 优先使用SVIP时间
      if (svipExpire && svipExpire > now) {
        memberInfo.level = 'svip'
        memberInfo.expireDate = svipExpire.toLocaleDateString('zh-CN')
      } else if (vipExpire && vipExpire > now) {
        memberInfo.level = 'vip'
        memberInfo.expireDate = vipExpire.toLocaleDateString('zh-CN')
      } else {
        memberInfo.level = 'none'
        memberInfo.expireDate = ''
      }
    },
    
    // 加载会员信息
    loadMemberInfo() {
      const savedInfo = localStorage.getItem('userMemberInfo')
      if (savedInfo) {
        try {
          const memberInfo = JSON.parse(savedInfo)
          // 确保数据结构完整
          this.userMemberInfo = {
            level: memberInfo.level || 'none',
            expireDate: memberInfo.expireDate || '',
            vipExpireDate: memberInfo.vipExpireDate || '',
            svipExpireDate: memberInfo.svipExpireDate || '',
            memberLevel: memberInfo.memberLevel || 0,
            growthValue: memberInfo.growthValue || 0,
            autoRenew: memberInfo.autoRenew || false,
            continuousPlan: memberInfo.continuousPlan || '',
            isTrial: memberInfo.isTrial || false,
          }
          // 更新活跃会员信息
          this.updateActiveMember(this.userMemberInfo)
        } catch (e) {
          console.error('加载会员信息失败', e)
        }
      }
    },
  },
}
</script>

<style scoped>
.vip-page {
  min-height: 100vh;
  background-color: #f5f5f5;
}

/* 顶部会员横幅 */
.vip-banner {
  background: linear-gradient(135deg, #ff6b6b, #4ecdc4, #45b7d1);
  color: white;
  padding: 60px 0;
  text-align: center;
}

.banner-content {
  max-width: 1200px;
  margin: 0 auto;
}

.vip-title {
  font-size: 48px;
  margin-bottom: 20px;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.vip-slogan {
  font-size: 20px;
  margin-bottom: 20px;
  opacity: 0.9;
}

.vip-promo {
  margin-bottom: 25px;
  animation: fadeInUp 0.8s ease-out;
}

.promo-text {
  background-color: rgba(255, 255, 255, 0.2);
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 16px;
  font-weight: 500;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.banner-actions {
  display: flex;
  gap: 20px;
  justify-content: center;
}

.btn-primary, .btn-secondary {
  padding: 12px 32px;
  border-radius: 30px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  border: none;
}

.btn-primary {
  background-color: #ffffff;
  color: #ff6b6b;
}

.btn-primary:hover {
  background-color: #f0f0f0;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.btn-secondary {
  background-color: transparent;
  color: white;
  border: 2px solid white;
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

/* 会员类型切换 */
.vip-tabs {
  background-color: white;
  display: flex;
  justify-content: center;
  border-bottom: 1px solid #e0e0e0;
}

.tab-item {
  padding: 20px 40px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
}

.tab-item:hover {
  color: #ff6b6b;
}

.tab-item.active {
  color: #ff6b6b;
  font-weight: 500;
}

.tab-item.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 3px;
  background-color: #ff6b6b;
  border-radius: 3px;
}

/* 特权内容区域 */
.vip-privileges {
  max-width: 1200px;
  margin: 40px auto;
  padding: 0 20px;
}

.privilege-section {
  margin-bottom: 60px;
}

.section-title {
  margin-bottom: 30px;
}

.section-badge {
  font-size: 24px;
  font-weight: bold;
  color: #333;
  position: relative;
  padding-left: 30px;
}

.section-badge::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 24px;
  background-color: #ff6b6b;
  border-radius: 3px;
}

.privilege-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 30px;
}

.privilege-item {
  background-color: white;
  padding: 30px 20px;
  border-radius: 10px;
  text-align: center;
  transition: all 0.3s;
  border: 1px solid #e0e0e0;
}

.privilege-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  border-color: #ff6b6b;
}

.privilege-icon {
  font-size: 48px;
  margin-bottom: 15px;
}

.privilege-name {
  font-size: 16px;
  font-weight: 500;
  color: #333;
  margin-bottom: 10px;
}

.privilege-desc {
  font-size: 14px;
  color: #666;
  line-height: 1.5;
}

/* 等级对比 */
.vip-levels {
  max-width: 1200px;
  margin: 40px auto;
  padding: 0 20px;
}

.level-comparison {
  background-color: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.level-header {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  background-color: #f8f9fa;
  border-bottom: 1px solid #e0e0e0;
}

.level-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  border-bottom: 1px solid #f0f0f0;
}

.level-row:last-child {
  border-bottom: none;
}

.level-item {
  padding: 20px;
  text-align: center;
  font-size: 16px;
}

.level-item.privilege-name {
  text-align: left;
  font-weight: 500;
  color: #333;
}

.level-item.free {
  background-color: #f8f9fa;
}

.level-item.vip {
  background-color: #fff3cd;
}

.level-item.svip {
  background-color: #d1ecf1;
}

/* 模态框 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background-color: white;
  border-radius: 10px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 30px;
  border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
  margin: 0;
  font-size: 24px;
  color: #333;
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #999;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s;
}

.modal-close:hover {
  background-color: #f0f0f0;
  color: #666;
}

.modal-body {
  padding: 30px;
}

.membership-tabs {
  display: flex;
  margin-bottom: 30px;
  border-bottom: 2px solid #e0e0e0;
}

.membership-tabs .tab-item {
  padding: 10px 30px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.3s;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.membership-tabs .tab-item:hover {
  color: #ff6b6b;
}

.membership-tabs .tab-item.active {
  color: #ff6b6b;
  border-bottom-color: #ff6b6b;
}

.pricing-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.pricing-card {
  padding: 20px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
}

.pricing-card:hover {
  border-color: #ff6b6b;
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.2);
}

.pricing-card.selected {
  border-color: #ff6b6b;
  background-color: #fff5f5;
}

.pricing-period {
  font-size: 18px;
  font-weight: 500;
  color: #333;
  margin-bottom: 10px;
}

.pricing-price {
  font-size: 28px;
  font-weight: bold;
  color: #ff6b6b;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.current-price {
  font-size: 28px;
  font-weight: bold;
  color: #ff6b6b;
}

.original-price {
  font-size: 16px;
  color: #999;
  text-decoration: line-through;
}

.pricing-discount {
  font-size: 12px;
  color: #ff6b6b;
  margin-top: 8px;
  padding: 4px 8px;
  background-color: #fff5f5;
  border-radius: 12px;
  display: inline-block;
}

.pricing-desc {
  font-size: 14px;
  color: #666;
}

.pricing-tag {
  position: absolute;
  top: -10px;
  right: -10px;
  background-color: #ff6b6b;
  color: white;
  padding: 5px 15px;
  border-radius: 15px;
  font-size: 12px;
  font-weight: 500;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 15px;
  padding: 20px 30px;
  border-top: 1px solid #e0e0e0;
}

/* 会员信息样式 */
.no-member {
  text-align: center;
  padding: 40px 0;
}

.no-member-icon {
  font-size: 64px;
  margin-bottom: 20px;
}

.no-member p {
  font-size: 18px;
  color: #666;
  margin-bottom: 30px;
}

.btn-primary.small {
  padding: 10px 24px;
  font-size: 14px;
}

.member-info {
  text-align: center;
  padding: 40px 0;
}

.member-level {
  margin-bottom: 30px;
}

.level-badge {
  display: inline-block;
  padding: 10px 30px;
  border-radius: 30px;
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 10px;
}

.level-badge.vip {
  background-color: #fff3cd;
  color: #856404;
}

.level-badge.svip {
  background-color: #d1ecf1;
  color: #0c5460;
}

.member-type {
  font-size: 18px;
  color: #666;
}

.member-details {
  margin-bottom: 30px;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
  padding: 0 40px;
}

.detail-label {
  font-size: 16px;
  color: #666;
}

.detail-value {
    font-size: 16px;
    font-weight: 500;
    color: #333;
  }
  
  .detail-value.expired {
    color: #999;
    text-decoration: line-through;
  }

/* 响应式设计 */
@media (max-width: 768px) {
  .vip-title {
    font-size: 36px;
  }
  
  .banner-actions {
    flex-direction: column;
    align-items: center;
  }
  
  .privilege-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .level-comparison {
    font-size: 14px;
  }
  
  .level-item {
    padding: 15px 10px;
  }
  
  .pricing-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .privilege-grid {
    grid-template-columns: 1fr;
  }
  
  .modal-content {
    margin: 20px;
  }
  
  .level-comparison {
    font-size: 12px;
  }
  
  .level-item {
    padding: 10px 5px;
  }
}
</style>